<?php

namespace App\Api\Eloquent;


class Role extends Model
{
    protected $table='roles';

    protected $fillable=['name','slug'];

    public static function getrole($id){
        $user_roles=Role::join('role_user','role_user.role_id','=','id')
            ->where('role_user.user_id','=',$id)
            ->get();
        $role=array();
        foreach($user_roles as $user_role){
            $role[]=$user_role->slug;
        }
        return $role;
    }
}